package com.study.talk.module.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.study.talk.module.entity.vo.MomentLikeVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "MomentLike对象", description = "")
public class MomentLike {

    @ApiModelProperty("点赞记录id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("动态id")
    private Integer momentId;

    @ApiModelProperty("点赞用户id")
    private Integer userId;

    @ApiModelProperty("点赞用户名")
    private String userName;

    @ApiModelProperty("点赞状态")
    private Integer likeState;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    public MomentLike(MomentLikeVo momentLikeVo) {
        this.momentId = momentLikeVo.getMomentId();
        this.userId = momentLikeVo.getUserId();
        this.userName = momentLikeVo.getUserName();
        this.likeState = momentLikeVo.getLikeState();
    }
}
